function th5groupput()

fprintf('\tTesting H5GROUPPUT...' );
v = version('-release');
if strcmp(v,'2006b')
    fprintf('\tNot testing on 2006b.\n');
    return
end

tfile='testlink6.h5';
gentestfile(tfile);

test_put(tfile);
test_multipleput(tfile)
delete(tfile);

fprintf('OK\n');
end

%--------------------------------------------------------------------------
function gentestfile(fname)

h5id=h5filecreate(fname);
%add a group
H5F.close(h5id);
end


%--------------------------------------------------------------------------
function test_put(fname)

h5groupput(fname,'/testgroup');
di=hdf5info(fname);

if (~isequal(di.GroupHierarchy.Groups.Name,'/testgroup'))
    error('group not created');
end
end

%--------------------------------------------------------------------------
function test_multipleput(fname)

switch(version('-release'))
case { '2007a', '2007b', '2008a', '2008b' }
	% Below 2009a does not have the capability to create a deep group.
    return;
end
h5groupput(fname,'/testgroup2/testgroup');
di=hdf5info(fname);

if (~isequal(di.GroupHierarchy.Groups(2).Groups.Name,'/testgroup2/testgroup'))
    error('group not created');
end
end
